// 第一个例子

DELETE cc-logs*

PUT /cc-logs-000001
{
    "aliases": {
        "cc_logs_write": {}
    }
}

// 写入6次
POST cc_logs_write/_doc
{
    "log": "log something"
}
// 查看数量
GET /cc_logs_write/_count

// 对 alias index 进行操作
POST /cc_logs_write/_rollover
{
    "conditions": {
        "max_age": "1d",
        "max_docs": 4,
        "max_size": "5gb"
    }
}

// 再次查看数量
GET /cc_logs_write/_count

// 查看 alias 信息
GET /cc_logs_write

// 查看旧的index
GET /cc-logs-000001/_count


// 第二个例子: is_write_index
DELETE ab-logs*

PUT /ab-logs1
{
    "aliases": {
        "ab_logs_write": {
            "is_write_index": true
        }
    }
}

GET ab_logs_write/_count

// 写入log x5
POST ab_logs_write/_doc
{
    "log": "log something"
}

// 需要指定target的名称
POST /ab_logs_write/_rollover/ab-logs2
{
    "conditions": {
        "max_age": "1d",
        "max_docs": 2,
        "max_size": "5gb"
    }
}
// 再次写入log x5
POST ab_logs_write/_doc
{
    "log": "log something"
}

POST /ab_logs_write/_rollover/ab-logs3
{
    "conditions": {
        "max_age": "1d",
        "max_docs": 2,
        "max_size": "5gb"
    }
}

// 注意看结果的数量, 是写入log的和
GET ab_logs_write/_count

// 再看结果, 包含了所有的 index, 只是只有一个index的 "is_write_index": true
GET ab_logs_write